﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AlgoTester
{
    // Dummy class
    class Stock
    {
        // Data Members
        private string name;
        private string ticker;
        private Date day;
        private SortedList<Date, StockQuote> stockQuotes;

        public Stock(string name, string ticker, Date day)
        {
            this.name = name;
            this.ticker = ticker;
            this.day = day;
            this.stockQuotes = new SortedList<Date, StockQuote>();
        }

        public Stock(string name, string ticker, Date day, List<StockQuote> stockQuotes)
        {
            this.name = name;
            this.ticker = ticker;
            this.day = day;
            this.stockQuotes = makeStockQuoteList(stockQuotes);
        }

        // Functions
        public void nextDay(Date day)
        {
            return;
        }

        public double getCurrentPrice()
        {
            return 0.0;
        }

        public string getTicker()
        {
            return null;
        }

        public StockQuote getQuote(int i)
        {
            Date tempo = day;
            for (int j = 0; j < i; j++)
            {
                tempo.decrement();
            }
            StockQuote q;
            stockQuotes.TryGetValue(tempo, out q);
            return q;
        }

        private SortedList<Date, StockQuote> makeStockQuoteList
            (List<StockQuote> stockQuotes)
        {
            SortedList<Date, StockQuote> returnList = new SortedList<Date, StockQuote>();
            foreach (StockQuote quote in stockQuotes)
                returnList.Add(quote.getDate(), quote);
            return returnList;
        }

    }
}
